import request from "@/utils/request";

// 查询商家信息列表
export function listStore(query) {
  return request({
    url: "/ds/store/list",
    method: "get",
    params: query,
  });
}

// 查询商家信息详细
export function getStore(id) {
  return request({
    url: "/ds/store/" + id,
    method: "get",
  });
}

// 新增商家信息
export function addStore(data) {
  return request({
    url: "/ds/store",
    method: "post",
    data: data,
  });
}

// 入驻商家信息
export function storeJoin(data) {
  return request({
    url: "/ds/store/adds",
    method: "get",
    params: data,
  });
}

// 修改商家信息
export function updateStore(data) {
  console.log("data:", data);
  return request({
    url: "/ds/store",
    method: "put",
    data: data,
  });
}
/**
 * 通过店铺
 * @param {*} data
 * @returns
 */
export function passStore(data) {
  return request({
    url: "/ds/store/toExamine",
    method: "get",
    params: data,
  });
}

// 删除商家信息
export function delStore(id) {
  return request({
    url: "/ds/store/" + id,
    method: "delete",
  });
}

// 导出商家信息
export function exportStore(query) {
  return request({
    url: "/ds/store/export",
    method: "get",
    params: query,
  });
}

// 查询商家商品信息列表
export function listGoods(query) {
  return request({
    url: "/ds/home/products",
    method: "get",
    params: query,
  });
}

// 查询商家商品信息详细
export function getGoods(id) {
  return request({
    url: "/ds/products/" + id,
    method: "get",
  });
}

// 新增商家商品信息
export function addGoods(data) {
  return request({
    url: "/ds/products",
    method: "post",
    data: data,
  });
}

// 修改商家商品信息
export function updateGoods(data) {
  console.log("data:", data);
  return request({
    url: "/ds/products",
    method: "put",
    data: data,
  });
}

// 删除商家商品信息
export function delGoods(id) {
  return request({
    url: "/ds/products/" + id,
    method: "delete",
  });
}

// 导出商家商品信息
export function exportGoods(query) {
  return request({
    url: "/ds/products/export",
    method: "get",
    params: query,
  });
}
/**
 * 商家申请提现明细
 * @param {*} query
 * @returns
 */
export const recordList = (query) => {
  return request({
    url: "/ds/record/list",
    method: "get",
    params: query,
  });
};
/**
 * 新商家申请提现明细
 * @param {*} query
 * @returns
 */
export const storeList = (query) => {
  return request({
    url: "/ds/record/storeList",
    method: "get",
    params: query,
  });
};

/**
 * 同意驳回商家提现
 * @param {*} query
 * @returns
 */
export const reviewWithDrawal = (query) => {
  return request({
    url: "/ds/store/reviewSecondWithdrawal",
    method: "get",
    params: query,
  });
};

/**
 * 修改店铺信息
 * @param {*} query
 * @returns
 */
export const storeEdit = (query) => {
  return request({
    url: "/ds/store/edit",
    method: "get",
    params: query,
  });
};

/**
 * 商家提现导出
 * @param {*} query
 * @returns
 */
export const exportRecord = (query) => {
  return request({
    url: "/ds/record/export",
    method: "get",
    params: query,
  });
};

/**
 * 导出
 * @param {*} query
 * @returns
 */
export const storeExport = (query) => {
  return request({
    url: "/ds/record/storeExport",
    method: "get",
    params: query,
  });
};

/**
 * 商家审核上架下架
 * @param {*} query
 * @returns
 */
export const updateStatueStore = (query) => {
  return request({
    url: "/ds/store/edit",
    method: "get",
    params: query,
  });
};
/**
 * 商家账户变动记录
 * @param {*} query
 * @returns
 */
 export const stIdList = (query) => {
  return request({
    url: "/ds/record/stIdList",
    method: "get",
    params: query,
  });
};